#include "ducksimulator.h"

#include "cannotquack.h"
#include "canquack.h"
#include "duck.h"
#include "duckcallquack.h"
#include "gooseadapter.h"
#include "mallardduck.h"
#include "quackable.h"
#include "redheadduck.h"
#include "rubberduckquack.h"

#include <qDebug>

DuckSimulator::DuckSimulator() {}

void DuckSimulator::simulate()
{
    Quackable *can_quack_behavior = new CanQuack();
    Quackable *can_not_quack_behavior = new CanNotQuack();
    Quackable *duck_call_behavior = new DuckCallQuack();
    Quackable *rubber_duck_quack_behavior = new RubberDuckQuack();

    Duck *mallard_duck = new MallardDuck(can_quack_behavior);
    Duck *red_head_duck = new RedheadDuck(rubber_duck_quack_behavior);
    // Duck *duck_call=new DuckCall

    qDebug() << "Duck simulator...";
    simulate(mallard_duck);
    simulate(red_head_duck);

    Duck *goose_adapter = new GooseAdapter(new Goose());
    simulate(goose_adapter);
}

void DuckSimulator::simulate(Duck *duck)
{
    if (duck)
    {
        duck->quack();
    }
}
